Skip to content

Get the right data when the navigator has multiple top-level roots and multiple languages#980

Merged
marinaaisa merged 1 commit intoswiftlang:mainfrom
marinaaisa:navigator-multiple-top-level
Dec 8, 2025
Merged

Get the right data when the navigator has multiple top-level roots and multiple languages#980
marinaaisa merged 1 commit intoswiftlang:mainfrom
marinaaisa:navigator-multiple-top-level

Conversation

@marinaaisa
Copy link
Member

Bug/issue #158778571, if applicable:

Summary

In the use cases of navigators with multiple top-level root and multiple languages, we want to make sure that the URL queries that are added in different languages don't interfere with the election of the top-level root node.

Before, we were reading the window.location.href, which includes queries. Now, by using the window.location.pathname property, we ignore the queries, which makes possible to compare with the node.path value to find which it's the correct top-level root.

Example: URL: http://localhost:8080/documentation/foo?language=objc
Navigator path: /documentation/foo

By using window.location.pathname we ignore ?language=objc and we can compare /documentation/foo with /documentation/foo

Dependencies

NA

Testing

Steps:

  1. Run DocC Render with a .doccarchive that has a navigator with multiple top-level roots and multiple languages (Swift, Obj-C)
  2. Assert that the navigators are rendering correctly

Checklist

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

@marinaaisa marinaaisa requested a review from mportiz08 November 25, 2025 18:19
@heckj
Copy link
Member

heckj commented Dec 4, 2025

@swift-ci please test

In the use cases of navigators with multiple top-level root, we want to
make sure that queries don't interfere with the election of the
top-level root node when extracting the root node.

Before we were reading the window.location.href, which includes queries.
Now, by using the window.location.pathname, we ignore the queries, which
makes possible to compare with the node.path value to find which it's
the correct top-level root.

Example: URL: 'http://localhost:8080/documentation/foo?language=objc'
Navigator path: '/documentation/foo'

By using `window.location.pathname` we ignore `?language=objc` and we
can compare `/documentation/foo` with `/documentation/foo`
@marinaaisa marinaaisa force-pushed the navigator-multiple-top-level branch from a1696c7 to ecb8edd Compare December 8, 2025 12:38
@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa marinaaisa merged commit 92c5828 into swiftlang:main Dec 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants